#pragma once
#include <string>
#include "properties.h"

typedef unsigned char byte;

namespace gfutilities{ namespace memory
{
//-------------------------------------------------------------------------------
class buffer
{
public:
	buffer(void){}
	buffer(size_t size, const byte* data = NULL);
	buffer(const buffer& other);

	virtual ~buffer(void){}

	property_get_not_const(byte*,	data);
	property_get(size_t,		size);
	property_get(bool,			empty);
	property_get(std::string,	as_string);
	property_get(std::wstring,	as_wstring);

	virtual void	append(const byte* pdata, size_t dsize);
	virtual void	assign(const byte* pdata, size_t dsize);
	virtual size_t	resize(size_t new_size);

	void  clear();

	buffer& operator=(const buffer& other);
	bool operator==(const buffer& other) const ;
	bool operator!=(const buffer& other) const ;
	buffer& operator += (const buffer& other);

	operator byte*() const ;
	operator const byte*() const ;

protected:
	std::string _data;
};
//---------------------------------------------------------------------------
}}